<?php
function smarty_block_arclist($params, $content, &$smarty)
{
	//var_dump($content)，数据是下面这样滴...;
//		<tr>
//
//				<td>[$filed.did]</td>
//
//				<td>[$filed.title]</td>
//
//				<td>[$filed.content]</td>
//
//			</tr>
	
	//如果没有param['cid']，查询所有分类数据
	$cid = isset($params['cid']) ? $params['cid'] : null;
	//没有传row【获取数据的条数】,默认1000条
	$row = isset($params['row']) ? $params['row'] : 1000;
	$model = new Model();
	if($cid){
		$sql = "select * from arcticle where cid={$cid} limit {$row}";
	}else{
		$sql = "select * from arcticle limit {$row}";
	}
	$data = $model->query($sql);
	p($data);//数据参考shuju.php
	$str = "";
	foreach ($data as $k => $v) {
		$c = $content;
		foreach ($v as $key => $value) {
			$c = str_replace("[\$filed.{$key}]", $value, $c);
		}
		$str .= $c;
	}
	//var_dump($str);
	return $str;
	
	
	
	
}

/* vim: set expandtab: */

?>
